function Combox_Project() {
	$.ajax({
		type : "POST",
		url : "../ProjectController/findByCondition.action",
		data : {
			"projectParentId":-1,
		},
		success : function(data) {
			var html ="";
			$.each(JSON.parse(data), function(j, o) {
				html += '<option value="' + o.projectId + '">' + o.projectName
						+ '</option>';
			});
			$("#ProjectCombox_paper").html(html);
		},
		error : function(request) {
			toastr.error("多选框错误!");
		}
	});
}
function Combox_Dictionary() {
	$.ajax({
		type : "POST",
		url : "../DictionaryController/findByCondition.action",
		data : {
			"dictionaryType":"题目难度",
		},
		success : function(data) {
		
			var html = "";
			$.each(JSON.parse(data), function(j, o) {
				html += '<option value="' + o.dictionaryKey + '">' + o.dictionaryValue
						+ '</option>';
			});
			$("#DictionaryCombox").html(html);
			
		},
		error : function(request) {
			toastr.error("多选框错误!");
		}
	});
}

function findPaper(data1){
	return '<button id="find" onClick="check('+data1+')" class="btn2 btn-info">查看试题</button>';
}

function check(data1){

	window.location.href="paper_detail.action?paperId="+data1;
			
	
}
function queryParams(params) {
	return {
		
		paperName: $('#paperName').val(),
	};
}

$('#reset').click(function() {
	 $('#paperName').val(""),
	 $('#Paper').bootstrapTable('refresh', {url: '../PaperController/findByCondition.action'});  
	 
});

$("#submitPaper").click(function(){
	$("#paperList").submit();
});
	
$(function() {
	Combox_Project();
	Combox_Dictionary();
	$("#TitleForm").validate({
		rules: {			
			paperName:"required",
		    number:"required",
			time:"required",
			prjectId:"required",
		},
		errorPlacement: function (label, element) {
            $(element).tooltip('destroy'); /*必需*/
            $(element).attr('paper', $(label).text()).tooltip('show'); 
        },
	});

	init('Paper',600,500,"paperId","试卷");
});

